/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sip;

/**
 *
 * @author arianareyessantiago
 */
public class CheckBubblesThread implements Runnable{
    CheckStatus check = new CheckStatus();
    public static volatile boolean running = true;
    private static Boolean bubblesFlag = false;
    
    /**
     *
     */
    @Override
    public void run(){
        int checkInterval = 100; //in miliseconds
        while(running){
           //System.out.println("Bubble Thread");
           bubblesFlag = check.checkBubbles();
           if(bubblesFlag){
               running = false;
               System.exit(1);
           }
            
            try{
                Thread.sleep(checkInterval);
            }
            catch(InterruptedException e){   
            }

        }

        
    }
    public void terminate(){
        SipLogger.Instance().debug("CheckBubblesThread has been Terminated");
        running = false;
    }
    
}
